package com.dp.proxy.jdk_dynamic_proxy;

import com.dp.proxy.static_proxy.IUserDao;
import com.dp.proxy.static_proxy.UserDaoImpl;

/**
 * @Author: Ruomeng
 * @Date: 2024/11/28
 * @Description : design-pattern
 * @Version: 1.0
 */
public class TestDynamicProxy {

    public static void main(String[] args) {
        IUserDao userDao = new UserDaoImpl();
        // 打印目标对象的信息
        System.out.println(userDao.getClass());
        //  获取代理对象
        IUserDao proxy = (IUserDao) new ProxyFactory(userDao).getProxyInstance();
        System.out.println(proxy.getClass());
        // 代理方法
        proxy.save();
    }
}
